<template>
  <!--投稿流程管理-->
  <div class="wrapper">
  <VueUeditorWrap v-model="data.submissionprocess" :config="myConfig"></VueUeditorWrap>
  <div>
    <Button type="primary" @click="save">保存</Button>
  </div>
</div>
</template>

<script>
  import VueUeditorWrap from 'vue-ueditor-wrap'

  export default {
    components: {
      VueUeditorWrap
    },
    data() {
      return {
        /*查询url*/
        inquireurl: this.$api.url + '/thesis/process/selectSubmissionprocess',
        /*富文本编辑器*/
        data:{
          createUser: 1,
          submissionprocess:'',
          id:'',
        },
        myConfig:{
          UEDITOR_HOME_URL: './static/ue/',
          // 编辑器不自动被内容撑高
          autoHeightEnabled: false,
          // 初始容器高度
          initialFrameHeight: 350,
          // 初始容器宽度
          initialFrameWidth: 1000,
          // 关闭自动保存
          enableAutoSave: false
        },
      }
    },
    mounted() {
      window.scrollTo(0,0);
      this.get(this.inquireurl)
    },
    methods: {
      save(){
        this.post(this.$api.url + '/thesis/process/updateTP')
      },
      /*post请求*/
      post(url) {
        this.$axios({
          method: 'POST',
          headers: {'Content-Type': 'application/json;charset=UTF-8'},
          data: JSON.stringify(this.data),
          url: url,
        }).then((res) => {
          this.$router.go(0)
        })
      },
      /*get请求*/
      get(url) {
        this.$axios.get(url).then((res) => {
          this.data.submissionprocess = res.data[0].submissionprocess;
          this.data.id = res.data[0].id
        });
      },

    },
  }
</script>

<style scoped>
  .wrapper {
    margin: 10px;
  }

  .add_style {
    padding-bottom: 10px;
  }

  .add_style > span {
    font-size: 14px;
    font-weight: bold;
    display: inline-block;
    width: 70px;
  }
</style>
